<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@include file="/WEB-INF/commit/head.jsp"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<div class="layui-body">
    <div style="padding: 15px;">
    	<i class="layui-icon">&#xe66f;</i>新增用户
		<hr class="layui-bg-green">
    	<form class="layui-form" action="user/doadd.html" method="post" enctype="multipart/form-data">
			 <div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">用户角色：</label>
			      <div class="layui-input-inline">
			        <select name="roleid">
			          	<option value="">请选择</option>
						<option value="1">会员</option>
						<option value="2">管理员</option>
						<option value="11">其他</option>
			        </select>
			      </div>
			    </div>
			    <div class="layui-inline">
			      <label class="layui-form-label">会员类型：</label>
			      <div class="layui-input-inline">
			        <select name="usertype" lay-search="" lay-verify="required">
			          	<option value="">请选择</option>
						<option value="0">注册会员</option>
						<option value="1">消费会员</option>
						<option value="0">vip会员</option>
						<option value="1">加盟店</option>
			        </select>
			      </div>
			    </div>
			  </div>
			  
			<div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">用户名：</label>
			      <div class="layui-input-inline">
			        <input id="code" name="logincode" class="layui-input" type="tel" autocomplete="off" lay-verify="required|phone">
			      </div>
			      <div id="namecheck"></div>
			    </div>
			    <div class="layui-inline">
			      <label class="layui-form-label">姓名：</label>
			      <div class="layui-input-inline">
			        <input name="username" class="layui-input" type="text" autocomplete="off" lay-verify="email">
			      </div>
			    </div>
			</div>
			
			<div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">证件类型：</label>
			      <div class="layui-input-inline">
			        <select name="cardtype">
			          	<option value="">请选择</option>
						<option value="0">二代身份证</option>
						<option value="1">护照</option>
						<option value="2">军官证</option>
			        </select>
			      </div>
			    </div>
			    <div class="layui-inline">
			      <label class="layui-form-label">证件号码：</label>
			      <div class="layui-input-inline">
			        <input name=idcard class="layui-input" type="text" autocomplete="off" lay-verify="email">
			      </div>
			    </div>
			</div>
			
			<div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">收获国家：</label>
			      <div class="layui-input-inline">
			        <select name="country">
			          	<option value="">请选择</option>
						<option value="0">中国</option>
						<option value="1">美国</option>
			        </select>
			      </div>
			    </div>
			    <div class="layui-inline">
			      <label class="layui-form-label">移动电话：</label>
			      <div class="layui-input-inline">
			        <input name="mobile" class="layui-input" type="text" autocomplete="off" lay-verify="email">
			      </div>
			    </div>
			</div>
			
			<div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">电子邮件：</label>
			      <div class="layui-input-inline">
			        <input name="email" class="layui-input" type="tel" autocomplete="off" lay-verify="required|phone">
			      </div>
			    </div>

			<div class="layui-form-item">
			    <div class="layui-inline">
			      <label class="layui-form-label">开户行：</label>
			      <div class="layui-input-inline">
			        <input name="postcode" class="layui-input" type="tel" autocomplete="off" lay-verify="required|phone">
			      </div>
			    </div>
			    <div class="layui-inline">
			      <label class="layui-form-label">开户卡号：</label>
			      <div class="layui-input-inline">
			        <input name="bankaccount" class="layui-input" type="text" autocomplete="off" lay-verify="email">
			      </div>
			    </div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">开户人：</label>
				<div class="layui-input-block">
					<input type="text" name="accountholder" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">上传身份证图片（正反面）：</label>
				<div class="layui-input-block">
					<input type="file" name="partFile1" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-form-item">
				<label class="layui-form-label">上传银行卡图片：</label>
				<div class="layui-input-block">
					<input type="file" name="partFile2" required lay-verify="required" autocomplete="off" class="layui-input">
				</div>
			</div>
			
			<div class="layui-btn-group" style="padding-left: 1000px;">
<!-- 				<button class="layui-btn layui-btn-radius">保存</button>
 -->				<input id="save" type="submit" class="layui-btn layui-btn-radius" value="保存" >
					<input type="submit" class="layui-btn layui-btn-radius" value="关闭" >
			</div>
			
		</form>
    </div>
  </div>

  
<script type="text/javascript" src="js/jquery-1.12.4.js">
	$("#close").click(function(){
		window.location="user/userlist.html";
	})

<script type="text/javascript">

	$("#code").blur(function(){
			var name=$(this).val();
			$.post("user/serchByName.html","name="+name,function(check){
				if(check==0){
					$("#namecheck").html("用户名已被使用");
					$("#namecheck").css("color","red");
					$("#save").attr("disabled",true);
				}else{
					$("#namecheck").html("用户名可用");
					$("#namecheck").css("color","green");
					$("#save").attr("disabled",false);
				}
			})
			
		}) 

</script>
<%@include file="/WEB-INF/commit/dibu.jsp"%>